

project(qbprotocol LANGUAGES CXX C)

file(GLOB_RECURSE SRCS CONFIGURE_DEPENDS ./*.c ./*.cpp)
source_group_by_dir(SRCS)

include_directories(
    ${CMAKE_SOURCE_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}/./proto
    ${CMAKE_CURRENT_SOURCE_DIR}/./proto/zstd/common
)

add_library(${PROJECT_NAME} SHARED
     ${SRCS}
)

if(WINDOWS)
	target_link_libraries(${PROJECT_NAME} PRIVATE
    debug ${CMAKE_SOURCE_DIR}/source/core/thirdparty/zlib/lib/${BUILD_ARCH}/zlibd.lib
    optimized ${CMAKE_SOURCE_DIR}/source/core/thirdparty/zlib/libr/${BUILD_ARCH}/zlib.lib)
	target_link_libraries(${PROJECT_NAME} PRIVATE
    debug ${CMAKE_SOURCE_DIR}/source/core/thirdparty/zlib/lib/${BUILD_ARCH}/zlibstaticd.lib
    optimized ${CMAKE_SOURCE_DIR}/source/core/thirdparty/zlib/libr/${BUILD_ARCH}/zlibstatic.lib)
    target_link_libraries(${PROJECT_NAME} PRIVATE core)
    target_compile_options(${PROJECT_NAME} PRIVATE -DSSPROTO_EXPORTS -DNOT_USEQT -DZ_SOLO)
elseif(LINUX)
    target_link_libraries(${PROJECT_NAME} PRIVATE core)
    target_compile_options(${PROJECT_NAME} PRIVATE -DSSPROTO_EXPORTS -DNOT_USEQT  -DZ_SOLO)
elseif(MACOS)
    target_link_libraries(${PROJECT_NAME} PRIVATE core iconv z)
    target_compile_options(${PROJECT_NAME} PRIVATE -DSSPROTO_EXPORTS -DNOT_USEQT -DZ_SOLO)
endif()
